package com.hospital.hospital.controller;


import com.hospital.hospital.bean.DoctorClass;
import com.hospital.hospital.service.DoctorClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
public class DoctorClassController {

    @Autowired
    private DoctorClassService doctorClassService;


    @RequestMapping("/insertUi")
    public String insertUi(){
        return "insert";
    }

    @RequestMapping("/insert")
    public String insert(Model model, DoctorClass doctorClass) {
        try {
            doctorClassService.insert(doctorClass);
            model.addAttribute("doctorClass",doctorClass);
            return "redirect:/insertUi";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "redirect:/doctormanager";
    }

}
